package com.jzo2o.customer.controller.operation;

import com.jzo2o.common.model.PageResult;
import com.jzo2o.customer.mapper.WorkerCertificationAuditMapper;
import com.jzo2o.customer.model.domain.WorkerCertificationAudit;
import com.jzo2o.customer.model.dto.request.WorkerCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.service.IWorkerCertificationAuditService;
import com.jzo2o.customer.service.IWorkerCertificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController("operationWorkerCertificationAuditController")
@RequestMapping("/operation/worker-certification-audit")
@Api(tags = "运营端 - 审核服务人员认证信息相关接口")
public class WorkerCertificationAuditController {
    @Resource
    private IWorkerCertificationService workerCertificationService;
    @Resource
    private IWorkerCertificationAuditService workerCertificationAuditService;
    /**
     * 审核服务人员认证分页查询
     *
     * @param dto
     * @return
     */
    @GetMapping("/page")
    @ApiOperation("审核服务人员认证分页查询")
    public PageResult<WorkerCertificationAudit> queryWorkerByPage(WorkerCertificationAuditPageQueryReqDTO dto) {
        return workerCertificationService.queryWorkerByPage(dto);
    }

    /**
     * 审核服务人员认证信息
     *
     * @param id
     * @param cretificationStatus
     * @param rejectReason
     */
    @PutMapping("/audit/{id}")
    @ApiOperation("审核服务人员信息")
    public void auditWorker(@PathVariable("id") Long id,
                      @RequestParam("certificationStatus") Integer cretificationStatus,
                      @RequestParam("rejectReason") String rejectReason) {
        workerCertificationAuditService.auditWorker(id,cretificationStatus,rejectReason);
    }

}
